<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function Parent(name){
            this.name = [name]
        }

        Parent.prototype.getName = function() {
            return this.name
        }

        function Child() {
            Parent.call(this,'曹操')
        }
        //原型链继承
        //子类原型和父类原型指向同一个对象

        Child.prototype = Object.create(Parent.prototype)
        Child.prototype.constructor = Child

        
        const child1 = new Child()
        const child2 = new Child()
        child1.name[0] = '关羽'
        console.log(child1.name);
        console.log(child2.name);
        
        console.log(child1.getName())
    </script>
</body>
</html>